package com.fce.boc.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BindingConfig {
    /**
     * 绑定将队列和交换机绑定, 并设置用于匹配键：bocRoutingKey
     */
    @Bean
    Binding bindingBocQueue() {
        return BindingBuilder.bind(QueueConfig.callCore())
                .to(ExchangeConfig.directExchange())
                .with("bocRoutingKey");
    }


    /**
     * 绑定将队列和交换机绑定, 并设置用于匹配键：accumulatedRoutingKey
     */
    @Bean
    Binding bindingAccumulatedQueue() {
        return BindingBuilder.bind(QueueConfig.accumulated())
                .to(ExchangeConfig.directExchange())
                .with("accumulatedRoutingKey");
    }
}
